<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>紫色鹭</title>
    <link rel="icon" href="../img/login-sty1.png" type="image/x-icon"/>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/swiper.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" media="screen" href="../css/style_01.css">
    <style>
        .search_head .tab_box .tab_01_box .tab_01 {
            display: block;
        }
        html{overflow-y: scroll;}
    </style>
</head>
<body>
<div class="container"><div id="particles-js"></div></div>
<div class="header_top">
    <div class="container">
        您好，欢迎来到紫色鹭
        <span class="noToken">
            <a target="_blank"  onclick="parent.location.href = 'login.html'">请登录</a>
            <a target="_blank"  onclick="parent.location.href = 'register_01.html'">免费注册</a>
        </span>
        <span class="hasToken">
            <a target="_blank" ></a>
            <a target="_blank"  class="loginOut">退出登录</a>
        </span>
        <div class="fr">
            <a target="_blank"  onclick="parent.location.href = 'index.html'">紫色鹭首页</a>
            <a target="_blank" class="go-shop"><img class="img_shopcar" src="../img/shopcar_01.png">购物车<span class="car_num">0</span>件</a>
            <a target="_blank" class="go-store">店铺关注</a>
            <a target="_blank" class="go-authentication">企业认证</a>
        </div>
    </div>
</div>
<div class="html" v-cloak>
    <div class="search_head">
        <div class="container">
            <div class="clearfix">
                <div class="logo" onclick="location.href = 'index.html'"><img src="../img/logo_01.png" alt=""></div>
                <div class="search_center">
                    <div class="search_box">
                        <input type="text" placeholder="" onkeydown="toSearch(event)">
                        <button>搜索</button>
                    </div>
                    <!--<div class="hot">-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--<a target="_blank"  href="">康明斯</a>-->
                    <!--</div>-->
                </div>
                <div class="my_shopcar">
                    <i class="icon_shopcar"></i>我的购物车<span class="car-num">0</span></i>
                </div>
            </div>
            <div class="tab_box">
                <div class="tab_01_box">
                    <div class="title">
                        全部商品分类
                    </div>
                    <ul class="tab_01">
                        <li class="first-data" v-for="first in classList">{{first.name}}
                            <i class="icon_right_white"></i>
                            <div class="show-content">
                                <div class="first-c"><span class="first-text">{{first.name}}</span></div>
                                <div v-for="second in first.subordinate" class="second-sty1">
                                    <span class="icon_right icon-sty2"></span>
                                    <a target="_blank"  class="second-data go-list">{{second.name}}</a>
                                    <div class="cont">
                                        <a target="_blank"  class="third-data go-list"
                                           v-for="third in second.subordinate">{{third.name}}</a>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                    <div class="tab_02">

                    </div>
                </div>
                <div class="list">
                    <a target="_blank"  href="index.html">首页</a>
                    <a target="_blank"  href="product_list.html">产品</a>
                    <a target="_blank">公司</a>
                    <a target="_blank">资讯</a>
                    <a target="_blank">论坛</a>
                    <!--<a target="_blank"  href="my_order.html" v-show="type==2?true:false">我的订单</a>-->
                    <!--<a target="_blank"  href="Submission.html" v-show="type==2?false:true">我要开店</a>-->
                    <a target="_blank" v-if="Token"  href="http://www.ziselu.com/purple_heron_merchants">我的店铺</a>


                </div>
            </div>
        </div>
    </div>
    <div class="index container">
        <div class="banner clearfix">
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div class="swiper-slide" v-for="(item,index) in banner" @click="bannerJump(item.link,item.content)">
                        <img :src="imgBaseUrl + item.picUrl">
                    </div>
                </div>
                <div class="swiper-pagination"></div>
            </div>
            <div class="right">
                <div class="box-right-status">
                    <div class="text-c">
                        <img style="height: 55px;width: 55px;" :src="showHead?imgBaseUrl + showHead:'../img/login-sty1.png'" alt="">
                    </div>
                    <div class="img ellipsis text-c">
                        <span>HI，{{nowTime}}{{username?'，' + username:''}}</span>
                    </div>
                    <!--<i class="icon_admin_red"></i><i class="icon_edit_red"></i><i class="icon_edit_red"></i>-->
                    <div class="box box-1" v-if="!Token">
                        <a target="_blank" href="login.html">登录</a>
                        <a target="_blank" href="register_01.html">注册</a>
                        <a target="_blank" class="ruzhu">入驻</a>
                    </div>

                    <div class="box box-2" v-if="Token">
                        <!--<i class="icon-jl"></i><i class="icon-order"></i>-->
                        <a style="width: 60px;" class="go-mystore">开店</a>
                        <a style="width: 60px;" target="_blank" href="http://www.ziselu.com/purple_heron_merchants/page/index.html">会员中心</a>
                    </div>

                </div>
                <div class="news">
                    <div class="title">资讯头条</div>
                    <ul>
                        <li><a target="_blank" href="">东风变速箱最新报道</a></li>
                        <li><a target="_blank" href="">东风变速箱最新报道</a></li>
                        <li><a target="_blank" href="">东风变速箱最新报道</a></li>
                        <li><a target="_blank" href="">东风变速箱最新报道</a></li>
                        <li><a target="_blank" href="">东风变速箱最新报道</a></li>
                    </ul>
                    <div class="more">查看更多 <i class="icon_right_blue"></i></div>
                </div>
            </div>
        </div>
        <div class="index_list">
            <div id="rz" class="brand">
                <div class="title">入驻品牌 <span>Entering brand</span></div>
                <div class="box">
                    <ul class="clearfix">
                        <li v-for="item in brandList" class="brand-search">
                            <img :data-original="imgBaseUrl+item.picUrl" alt="" class="img">
                            <div class="hover">
                                <p>{{item.name}}</p>
                                <a target="_blank">点击进入</a>
                            </div>
                        </li>

                    </ul>
                </div>
            </div>
            <div id="fd" class="list">
                <div class="title" style="border-color: #f66955;">
                    <span class="chName ftype-golist">发动机系统</span><span>Engine system</span>
                    <div class="link">
                        <a target="_blank" v-for="item in sList.sList_0" class="go-prolist">{{item.name}}</a>
                        <a target="_blank" class="more">查看更多 <i class="icon_right"></i></a>
                    </div>
                </div>
                <div class="box clearfix">
                    <div class="first fl">
                        <img class="img" data-original="../img/index_01.png" alt="">
                        <div class="hover"><p class="ftype-golist">发动机系统</p></div>
                    </div>
                    <div class="second fl">
                        <ul class="clearfix show">
                            <li v-for="item in list.list_0" @click="goProductDetail(item.id)">
                                <img class="img" :data-original="imgBaseUrl + item.picUrl[0]" alt="">
                                <div class="name">{{item.name}}</div>
                                <div class="price">¥ {{item.price}}</div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div id="cd" class="list">
                <div class="title" style="border-color: #88b3fc"><span
                        class="chName ftype-golist">传动系统</span><span>Transmission system</span>
                    <div class="link">
                        <a target="_blank" v-for="item in sList.sList_1" class="go-prolist">{{item.name}}</a>
                        <a target="_blank" class="more">查看更多 <i class="icon_right"></i></a>
                    </div>
                </div>
                <div class="box clearfix">
                    <div class="first fl">
                        <img class="img" data-original="../img/index_02.png" alt="">
                        <div class="hover">
                            <p class="ftype-golist">传动系统</p>
                        </div>
                    </div>
                    <div class="second fl">
                        <ul class="clearfix show">
                            <li v-for="item in list.list_1" @click="goProductDetail(item.id)">
                                <img class="img" data-original="../img/product_01.png" alt="">
                                <div class="name">{{item.name}}</div>
                                <div class="price">¥ {{item.price}}</div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div id="dp" class="list">
                <div class="title" style="border-color: #55cb8c"><span class="chName ftype-golist">转向系统</span><span>Chassis parts</span>
                    <div class="link">
                        <a target="_blank" v-for="item in sList.sList_2" class="go-prolist">{{item.name}}</a>
                        <a target="_blank" class="more">查看更多 <i class="icon_right"></i></a>
                    </div>
                </div>
                <div class="box clearfix">
                    <div class="first fl">
                        <img class="img" data-original="../img/index_03.png" alt="">
                        <div class="hover">
                            <p class="ftype-golist">转向系统</p>
                        </div>
                    </div>
                    <div class="second fl">
                        <ul class="clearfix show">
                            <li v-for="item in list.list_2" @click="goProductDetail(item.id)">
                                <img class="img" data-original="../img/product_01.png" alt="">
                                <div class="name">{{item.name}}</div>
                                <div class="price">¥ {{item.price}}</div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div id="qc" class="list">
                <div class="title" style="border-color: #fab130"><span
                        class="chName ftype-golist">汽车电器</span><span>Vehicle electrical</span>
                    <div class="link">
                        <a target="_blank" v-for="item in sList.sList_3" class="go-prolist">{{item.name}}</a>
                        <a target="_blank" class="more">查看更多 <i class="icon_right"></i></a>
                    </div>
                </div>
                <div class="box clearfix">
                    <div class="first fl">
                        <img class="img" data-original="../img/index_04.png" alt="">
                        <div class="hover">
                            <p class="ftype-golist">汽车电器</p>
                        </div>
                    </div>
                    <div class="second fl">
                        <ul class="clearfix show">
                            <li v-for="item in list.list_3" @click="goProductDetail(item.id)">
                                <img class="img" data-original="../img/product_01.png" alt="">
                                <div class="name">{{item.name}}</div>
                                <div class="price">¥ {{item.price}}</div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div id="cs" class="list">
                <div class="title" style="border-color: #62bbdb"><span class="chName ftype-golist">车身系统</span><span>Body system</span>
                    <div class="link">
                        <a target="_blank" v-for="item in sList.sList_4" class="go-prolist">{{item.name}}</a>
                        <a target="_blank" class="more">查看更多 <i class="icon_right"></i></a>
                    </div>
                </div>
                <div class="box clearfix">
                    <div class="first fl">
                        <img class="img" data-original="../img/index_05.png" alt="">
                        <div class="hover">
                            <p class="ftype-golist">车身系统</p>
                        </div>
                    </div>
                    <div class="second fl">
                        <ul class="clearfix show">
                            <li v-for="item in list.list_4" @click="goProductDetail(item.id)">
                                <img class="img" data-original="../img/product_01.png" alt="">
                                <div class="name">{{item.name}}</div>
                                <div class="price">¥ {{item.price}}</div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div id="mr" class="list">
                <div class="title" style="border-color: #9380bd"><span
                        class="chName ftype-golist">美容养护</span><span>Beauty maintenance</span>
                    <div class="link">
                        <a target="_blank" v-for="item in sList.sList_5" class="go-prolist">{{item.name}}</a>
                        <a target="_blank" class="more">查看更多 <i class="icon_right"></i></a>
                    </div>
                </div>
                <div class="box clearfix">
                    <div class="first fl">
                        <img class="img" data-original="../img/index_06.png" alt="">
                        <div class="hover">
                            <p class="ftype-golist">美容养护</p>
                        </div>
                    </div>
                    <div class="second fl">
                        <ul class="clearfix show">
                            <li v-for="item in list.list_5" @click="goProductDetail(item.id)">
                                <img class="img" data-original="../img/product_01.png" alt="">
                                <div class="name">{{item.name}}</div>
                                <div class="price">¥ {{item.price}}</div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>


        </div>
        <!--<div class="level">-->
            <!--<ul>-->
                <!--<li class="level-act">导航</li>-->
                <!--<li><a href="#rz">入驻<br>品牌</a></li>-->
                <!--<li><a href="#fd">发动<br>机系统</a></li>-->
                <!--<li><a href="#cd">传动<br>系统</a></li>-->
                <!--<li><a href="#dp">转向<br>系统</a></li>-->
                <!--<li><a href="#qc">汽车<br>电器</a></li>-->
                <!--<li><a href="#cs">车身<br>系统</a></li>-->
                <!--<li><a href="#mr">美容<br>养护</a></li>-->
                <!--<li onclick="$('html,body').animate({scrollTop:0}, 500);"><i class="icon_top"></i><br>顶部</li>-->
            <!--</ul>-->
        <!--</div>-->
    </div>
</div>
<div class="footer_01" style="display: none;">
    <div class="container clearfix">
        <ul>
            <li>
                <img data-original="../img/footer_01.png" alt="">
                <div class="box">
                    <span>质量保障</span><br>
                    <i>正规渠道，质量保障</i>
                </div>
            </li>
            <li>
                <img data-original="../img/footer_02.png" alt="">
                <div class="box">
                    <span>品类齐全</span><br>
                    <i>各大车系千万配件，一站购齐</i>
                </div>
            </li>
            <li>
                <img data-original="../img/footer_03.png" alt="">
                <div class="box">
                    <span>全网低价</span><br>
                    <i>源头直达，价格大幅优于传统渠道</i>
                </div>
            </li>
            <li>
                <img data-original="../img/footer_04.png" alt="">
                <div class="box">
                    <span>售后无忧</span><br>
                    <i>安心选购，品牌保障，售后无忧</i>
                </div>
            </li>
        </ul>
    </div>
</div>
<div class="tabRight">
    <div class="first">
        <ul>
            <li><a target="_blank" class="icon_admin_white" title=""></a></li>
            <li>
                <a target="_blank" class="go-shopcard">
                    <i class="icon_shopcar_white"></i>
                    <p class="mt10">购<br>物<br>车</p>
                    <span class="car-num pos-Sty1">0</span>
                </a>
            </li>
            <li>
                <a target="_blank" class="icon_list_white mt10 go-myorder" title="订单"></a>
                <a target="_blank" class="icon_collect_white mt10 go-myhas" title="收藏"></a>
                <a target="_blank" class="icon_history_white mt10 go-record" title="记录"></a>
            </li>
        </ul>
    </div>
    <div class="second">
        <a target="_blank" class="icon_edit_white"></a>
        <a target="_blank" class="icon_top_white mt10"></a>
    </div>
</div>
<script src='../js/config.js'></script>
<script src="../js/swiper.min.js"></script>
<script src="../js/particles.min.js"></script>
<script src="../js/app.js"></script>
<script src="../js/lazy.js"></script>
<script>
    var nowDate = new Date().getTime();
    $(function () {
        <!--调用Luara示例-->
        var name = localStorage.getItem('username');
        $('.icon_admin_white').attr('title', name);
//        if(localStorage.getItem("Token")){
//            $('.box-1').css('display','none').siblings().css('display','block');
//        }else{
//            $('.box-2').css('display','block').siblings().css('display','none');
//        }
    });



    var app = new Vue({
        el: '.html',
        data: {
            imgBaseUrl: imgBaseUrl,
            banner: "",
            classList: localStorage.getItem("allClass") && (nowDate - localStorage.getItem("classTime")) < 180000?JSON.parse(localStorage.getItem("allClass")):'',
            brandList: '',
            Token: Token,
            list: {},
            sList: {},
            nowTime:"",
            username:localStorage.getItem("username"),
            showHead:localStorage.getItem('headImg'),
        },
        beforeCreate: function () {
            var that = this;
            //轮播
            get_ajax("/sys/banner/getBanners", {}, function (data) {
                that.banner = data;
                setTimeout(initBanner,10);
            })
            //分类
            if(!(localStorage.getItem("allClass") && (nowDate - localStorage.getItem("classTime")) < 180000)){
                get_ajax("sys/storeCommodityType/getAllList", {}, function (data) {
                    app.classList = data;
                    localStorage.setItem("classTime",nowDate);
                    localStorage.setItem("allClass",JSON.stringify(data));
                })
            }
            //获取全部品牌分页
            get_ajax("/sys/origin/getAllNewPage", {limit: 12, offset: 1}, function (data) {
                that.brandList = data
            })
        },
        updated: function () {
            var that = this;
            $(".footer_01").show();
//            Echo.init({
//                offset: 200,//离可视区域多少像素的图片可以被加载
//                throttle: 0 //图片延时多少毫秒加载
//            });
            $("img").lazyload({
                effect : "fadeIn", //渐现，show(直接显示),fadeIn(淡入),slideDown(下拉)
                threshold : 250, //预加载，在图片距离屏幕180px时提前载入
                event: 'scroll',  // 事件触发时才加载，click(点击),mouseover(鼠标划过),sporty(运动的),默认为scroll（滑动）
            });
        },
        methods: {
            goProductDetail: function (e) {
                location.href = "product_detail.html?productid=" + e;
            },
            bannerJump:function (href,html) {
                if(href){
                    window.open(href);
                }else{
                    localStorage.setItem("html",html);
                    window.open("activity.html");
                }
            },
        },
        mounted:function () {
            var now = new Date();
            var hour = now.getHours();
            if(hour < 6){this.nowTime = "凌晨好！"}
            else if (hour < 9){this.nowTime = "早上好！"}
            else if (hour < 11){this.nowTime = "上午好！"}
            else if (hour < 13){this.nowTime = "中午好！"}
            else if (hour < 16){this.nowTime = "下午好！"}
            else if (hour < 17){this.nowTime = "傍晚好！"}
            else if (hour < 23){this.nowTime = "晚上好！"}
            else {this.nowTime = "深夜好！"}

            if(localStorage.getItem("Token")){
                //同步接口修改html代码后，赋值父元素
                get_ajax("/web/auth/info",{},function (data) {
                    $(".hasToken a:first-child").text("你好，"+data.username);
                    $(".noToken").hide();
                    $(".hasToken").show();
                    if(data.storeId){
                        localStorage.setItem("storeId",data.storeId);
                    }
                    localStorage.setItem('type',data.type);
                    localStorage.setItem('userId',data.id);
                    localStorage.setItem('headImg',data.picUrl);
                    app.showHead = data.picUrl
                })

            }else{
                $(".noToken").show();
                $(".hasToken").hide();
            }
        }
    })


    $(document).on('click', '.go-mystore', function () {
        hasToken() ? window.open('store_info.html') : '';
    })

    //获取发动机3个产品
    var nameArr = ['发动机系统', '传动系统 ', '底盘配件', '汽车电器', '车身系统', '美容养护'];
    nameArr.forEach(function (items, index) {
        get_ajaxPage("/sys/storeCommodity/getPage", {limit: '3', offset: '1', name: nameArr[index]}, function (data) {
            data.data.forEach(function (item) {
                item.picUrl = item.picUrl.split(",");
            })
            Vue.set(app.list, "list_" + index, data.data);
        })
    })

    var firstID = ['100001', '100004', '100007', '100008', '100009', '100010'];
    firstID.forEach(function (items, index) {
        get_ajaxPage("/sys/storeCommodityType/getListByPid", {id: firstID[index]}, function (data) {
            Vue.set(app.sList, "sList_" + index, data.data);
        })
    })

    $(document).on('click', '.link .more', function () {
        var name = $(this).parents('.link').siblings('.chName').html();
        window.open('product_list.html?name=' + name)
    })

    $(document).on('click', '.go-prolist,.ftype-golist', function () {
        var name = $(this).html();
        window.open('product_list.html?name=' + name)
    })

    function initBanner() {
        var swiper = new Swiper('.swiper-container', {
            pagination: {
                el: '.swiper-pagination',
                clickable:true
            },
            autoplay: true,
            paginationClickable: true,
            loop: true,
        });
    }

    $(document).on('click','.brand-search',function(){
        var name = $(this).find('p').html();
        window.open('product_list.html?name='+name);
    })


    $("body").on("click", ".search_head .search_center .search_box button", function () {
        var name = $(".search_head .search_center .search_box input").val();
        location.href = "product_list.html?name=" + name;
    })
    function toSearch() {
        if (event.keyCode == "13") {
            var name = $(".search_head .search_center .search_box input").val();
            location.href = "product_list.html?name=" + name;
        }
    }

    //    //取出html代码重新赋值父页面search_head
    $(document).on("click", ".go-list", function () {
        var name = $(this).html();
        location.href = "product_list.html?type=" + name;
    })

    $("body").on("click",".loginOut",function () {
        localStorage.removeItem("Token");
        localStorage.removeItem("userId");
        localStorage.removeItem("storeId");
        localStorage.removeItem("storeId");
        localStorage.removeItem("username");
        localStorage.removeItem("headImg");
        noNeedLogin.indexOf(pageName(window.location.href)) == -1?location.href = "login.html":location.reload()
    })

    //    //楼层状态控制
    //    $(window).scroll(function(){
    //        var baseHeight = 512;
    //        var arr = [512];
    //        var addHeight = 0;
    //        $(".index_list>div").each(function () {
    //            addHeight += $(this).outerHeight();
    //            arr.push(baseHeight + addHeight);
    //        })
    //        for(var i = 0;i < arr.length;i++){
    //            if(scrollY > arr[i] && (scrollY <= arr[i+1] || !arr[i+1])){
    //                $(".level ul li").eq(i+1).addClass('hover').siblings().removeClass('hover');
    //                return
    //            }else if(scrollY < arr[0]){
    //                $(".level ul li").removeClass("hover");
    //                return
    //            }
    //        }
    //    })

</script>
</body>
</html>